package com.gzsj.genealogyManagement.people.domin;

import java.util.ArrayList;
import java.util.List;

public class Category implements Comparable<Category> {
    private String id;
    private String parentId;
    private int sort;

    private String content;

    private List<Category> children = new ArrayList<>();

    public Category(String id, String parentId, int sort,String content) {
        this.id = id;
        this.parentId = parentId;
        this.sort = sort;
        this.content = content;
    }

    public void addChild(Category child) {
        children.add(child);
    }

    public List<Category> getChildren() {
        return children;
    }

    public String getId() {
        return id;
    }

    @Override
    public int compareTo(Category o) {
        return Integer.compare(this.sort, o.sort);
    }

    @Override
    public String toString() {
        return id;
    }


    public void setId(String id) {
        this.id = id;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public int getSort() {
        return sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
}